package com.yeswater.rabbitmq_spingboot.consumer;

import com.yeswater.rabbitmq_spingboot.config.ConfirmConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.nio.charset.StandardCharsets;

/**
 * Author : yeswater
 */

@Slf4j
@Component
public class Consumer {

    @RabbitListener(queues = ConfirmConfig.CONFIRM_QUEUE_NAME)
    public void receiveConfirmMessage(Message message){
        System.out.println(new String(message.getBody(), StandardCharsets.UTF_8));
        log.info("接收 confirm队列消息: " + new String(message.getBody(),StandardCharsets.UTF_8));
    }

}
